package flexo.math;

public class Transformation
{
	private Vector position;
	private Quaternion rotation;
	private Vector scale;
	
	protected boolean updateRelativeMatrix;
	protected Matrix relativeMatrix;
	
	public Transformation()
	{
		position = new Vector();
		rotation = new Quaternion();
		scale = new Vector();
		updateRelativeMatrix = true;
	}
	
	public Matrix getRelativeTransformation()
	{
		if (updateRelativeMatrix)
		{
			relativeMatrix.reset();
			relativeMatrix.setRotation(rotation);
			updateRelativeMatrix = false;
		}
		return relativeMatrix;		
	}
	
	public Vector getPosition()
	{
		return position;
	}
	
	public Vector getScale()
	{
		return scale;
	}

	public void setPosition(Vector position)
	{
		this.position = position;
		updateRelativeMatrix = true;
	}
	
	public Quaternion getRotation()
	{
		return rotation;
	}

	public void setRotation(Quaternion rotation)
	{
		this.rotation = rotation;
		updateRelativeMatrix = true;
	}
	
	public void setScale(Vector scale)
	{
		this.scale = scale;
		updateRelativeMatrix = true;
	}
}